-
Notifications
You must be signed in to change notification settings - Fork 28
QMAPS-2088 Use ?q=
intention bbox as initial map position
#1066
QMAPS-2088 Use ?q=
intention bbox as initial map position
#1066
Conversation
?q=
intention bbox as initial map position?q=
intention bbox as initial map position
21d3474
to
b32fca4
Compare
6fae6fd
to
41c56f6
Compare
bin/middlewares/fullText_query.js
Outdated
getRedirectUrl(req.query.q, res) | ||
.then(redirectUrl => { | ||
if (redirectUrl) { | ||
res.redirect(307, redirectUrl); | ||
} else { | ||
next(); | ||
} | ||
}) | ||
.catch(error => { | ||
req.logger.error({ err: error }); | ||
next(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possible regression with this redirect mechanism is that the raw query is not preserved in the search bar.
The expected behavior in this case is unclear (also discussed in #1051).
Do you think it would be relevant to pass the raw query as an extra parameter in the URL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the new way things will work with the search bar, I believe it would be overwritten in any case by the POI name… I don't agree with this behavior but the design team seems to be quite positive with it.
I can pass it in any case to make it available to the front to decide what to do with it.
3bb8c00
to
5a587d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About telemetry events
This PR impacts 2 telemetry events:
app_start
:direct_search
field used to betrue
whenq
was present as a direct search querysuggest_selection
:from_url_query
field used to betrue
for the selection triggered by a direct search.
I would suggest to simply remove these fields that introduce unnecessary complexity, and use the existing ?client
to distinguish between the different sources of queries.
The mechanism used to trigger a search based on the URL parameter could actually be removed completely on the client side.
Then, the new middleware "fullText_query.js" could forward the client
parameter from the original URL (if present), and set client=direct-search
by default in the redirect URL.
@bbecquet What do you think ? And should this cleanup be done in a separate PR?
b0504c7
to
5c4363f
Compare
@amatissart Thanks for the encoding remark. |
Description
Add a new Express middleware to interpret incoming root urls containing a
?q=
param. If it resolves to a multi-place intention or a geocoding result, redirect to either a/places
or a/place
url, allowing to use the bbox or POI center as the initial map position (as now supported by #1064 and #1055).Why
Prevents the map initializing on a different start position before "jumping" to the bbox when the data is asynchronously fetched by the client app.